/**
 * A brief explanation for "project.json":
 * Here is the content of project.json file, this is the global configuration for your game, you can modify it to customize some behavior.
 * The detail of each field is under it.
 {
    "project_type": "javascript",
    // "project_type" indicate the program language of your project, you can ignore this field

    "debugMode"     : 1,
    // "debugMode" possible values :
    //      0 - No message will be printed.
    //      1 - cc.error, cc.assert, cc.warn, cc.log will print in console.
    //      2 - cc.error, cc.assert, cc.warn will print in console.
    //      3 - cc.error, cc.assert will print in console.
    //      4 - cc.error, cc.assert, cc.warn, cc.log will print on canvas, available only on web.
    //      5 - cc.error, cc.assert, cc.warn will print on canvas, available only on web.
    //      6 - cc.error, cc.assert will print on canvas, available only on web.

    "showFPS"       : true,
    // Left bottom corner fps information will show when "showFPS" equals true, otherwise it will be hide.

    "frameRate"     : 60,
    // "frameRate" set the wanted frame rate for your game, but the real fps depends on your game implementation and the running environment.

    "id"            : "gameCanvas",
    // "gameCanvas" sets the id of your canvas element on the web page, it's useful only on web.

    "renderMode"    : 0,
    // "renderMode" sets the renderer type, only useful on web :
    //      0 - Automatically chosen by engine
    //      1 - Forced to use canvas renderer
    //      2 - Forced to use WebGL renderer, but this will be ignored on mobile browsers

    "engineDir"     : "frameworks/cocos2d-html5/",
    // In debug mode, if you use the whole engine to develop your game, you should specify its relative path with "engineDir",
    // but if you are using a single engine file, you can ignore it.

    "modules"       : ["cocos2d"],
    // "modules" defines which modules you will need in your game, it's useful only on web,
    // using this can greatly reduce your game's resource size, and the cocos console tool can package your game with only the modules you set.
    // For details about modules definitions, you can refer to "../../frameworks/cocos2d-html5/modulesConfig.json".

    "jsList"        : [
    ]
    // "jsList" sets the list of js files in your game.
 }
 *
 */
function setUserArr(arr) {
	g_Array_Users=arr;
	g_Value_UserRank=-1;
	for (var i = 0; i < g_Array_Users.length; i++) {
		if (g_Array_Users[i][3]==g_String_openId) {
			g_Value_UserRank=i+1;
			g_Value_HighSocre=g_Array_Users[i][2];
			break;
		}
	}
	cc.log("g_Array_Users=",g_Array_Users);
	if (g_Value_UserRank==-1) {
		share(0,0,0);
	} else {
		share(1,g_Value_UserRank,g_Value_HighSocre);
	}
}
cc.game.onStart = function(){
    if(!cc.sys.isNative && document.getElementById("cocosLoading")) //If referenced loading.js, please remove it
        document.body.removeChild(document.getElementById("cocosLoading"));

    // Pass true to enable retina display, disabled by default to improve performance
    cc.view.enableRetina(false);
    // Adjust viewport meta
    cc.view.adjustViewPort(true);
    
    
    var continerw=cc.view.getFrameSize();
    // Setup the resolution policy and design resolution size
    //cc.view.setDesignResolutionSize(768, 1024, cc.ResolutionPolicy.SHOW_ALL);
    if (continerw.width>continerw.height) {
    	cc.view.setDesignResolutionSize(768, 1024, cc.ResolutionPolicy.SHOW_ALL);
    	theScaleH=1;
    }else{
    	cc.view.setDesignResolutionSize(768, 1024, cc.ResolutionPolicy.FIXED_WIDTH);
    	continerw=cc.view.getFrameSize();
    	theScaleH=continerw.height*768/continerw.width/1024;
    }
    WINSIZE=cc.winSize;
    
    
    
    // The game will be resized when browser size change
    cc.view.resizeWithBrowserSize(true);
    //load resources
    var arr=getUserInfo(1);
    g_String_serNmae=arr[0];
    g_String_openId=arr[1];   
    g_String_headUrl=arr[2];
    var arrd = g_String_headUrl.split("/");
    g_String_headUrl = "";
    for (var i = 0; i < arrd.length - 1; i++)
    {
    	g_String_headUrl +=  arrd[i]+"/";
    }
    g_String_headUrl+="64";
    cc.log("arr=",arr);
    formatTable();
    
    MyLoaderScene.preload(g_resources, function () {
    //cc.LoaderScene.preload(g_resources, function () {
    	cc.director.runScene(new StartPageScene());
    }, this);
};
cc.game.run();